home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
ip
/
ka9q
/
src890906.arc
/
SOCKET.H
< prev
next >
Wrap
C/C++ Source or Header
|
1989-08-18
|
4KB
|
148 lines
#ifndef SOCK_STREAM
#include "global.h"
/* IP protocol numbers */
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
/* TCP port numbers */
#define IPPORT_ECHO 7 /* Echo data port */
#define IPPORT_DISCARD 9 /* Discard data port */
#define IPPORT_FTPD 20 /* FTP Data port */
#define IPPORT_FTP 21 /* FTP Control port */
#define IPPORT_TELNET 23 /* Telnet port */
#define IPPORT_SMTP 25 /* Mail port */
#define IPPORT_FINGER 79 /* Finger port */
/* UDP port numbers */
#define IPPORT_DOMAIN 53
#define IPPORT_REMOTE 1234 /* Pulled out of the air */
#define AF_INET 0
#define AF_AX25 1
#define AF_NETROM 2
#define SOCK_STREAM 0
#define SOCK_DGRAM 1
#define SOCK_RAW 2
#define SOCK_SEQPACKET 3
#define EMFILE 1
#define EBADF 2
#define EINVAL 3
#define ESOCKTNOSUPPORT 4
#define EAFNOSUPPORT 5
#define EOPNOTSUPP 6
#define EFAULT 7
#define ENOTCONN 8
#define ECONNREFUSED 9
#define EAFNOSUPP 10
#define EISCONN 11
#define EWOULDBLOCK 12
#define EINTR 13
#define EADDRINUSE 14
#define ENOMEM 15
#define EMSGSIZE 16
/* Berkeley format socket address structures. These things were rather
* poorly thought out, but compatibility is important (or so they say).
* Note that all the sockaddr variants must be of the same size, 16 bytes
* to be specific. Although attempts have been made to account for alignment
* requirements (notably in sockaddr_ax), porters should check each
* structure.
*/
/* Generic socket address structure */
struct sockaddr {
short sa_family;
char sa_data[14];
};
/* This is a structure for "historical" reasons (whatever they are) */
struct in_addr {
unsigned long s_addr;
};
/* Socket address, DARPA Internet style */
struct sockaddr_in {
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
/* AX.25 sockaddr stuff */
/* Number of chars in callsign field */
#define ALEN 6
#ifndef NULLAXADDR
struct ax25_addr {
char call[ALEN];
char ssid;
};
#endif
/* Number of chars in interface field. The involved definition takes possible
* alignment requirements into account, since ax25_addr is of an odd size.
*/
#define ILEN (sizeof(struct sockaddr) - sizeof(short) - sizeof(struct ax25_addr))
/* Socket address, AX.25 style */
struct sockaddr_ax {
short sax_family; /* 2 bytes */
struct ax25_addr ax25_addr;
char iface[ILEN]; /* Interface name */
};
/* Netrom socket address.
* It is tempting to use two struct ax25_addr here, but that would not
* fulfil the size requirements */
#ifndef NR4MAXCIRC
struct nr4_addr {
char user_call[ALEN];
char user_ssid;
char node_call[ALEN];
char node_ssid;
};
#endif
struct sockaddr_nr {
short nr_family;
struct nr4_addr nr_addr;
};
#define SOCKSIZE (sizeof(struct sockaddr))
#define MAXSOCKSIZE SOCKSIZE /* All sockets are of the same size for now */
extern int32 Ip_addr;
/* In socket.c: */
int accept __ARGS((int s,char *peername,int *peernamelen));
int bind __ARGS((int s,char *name,int namelen));
int close_s __ARGS((int s));
int connect __ARGS((int s,char *peername,int peernamelen));
void freesock __ARGS((struct proc *pp));
int getpeername __ARGS((int s,char *peername,int *peernamelen));
int getsockname __ARGS((int s,char *name,int *namelen));
int listen __ARGS((int s,int backlog));
char *psocket __ARGS((void *p));
int recv __ARGS((int s,char *buf,int len,int flags));
int recv_mbuf __ARGS((int s,struct mbuf **bpp,int len,int flags,char *from,int *fromlen));
int recvchar __ARGS((int s,struct mbuf **bpp));
int recvline __ARGS((int s,char *buf,unsigned len));
int recvfrom __ARGS((int s,char *buf,int len,int flags,char *from,int *fromlen));
int send __ARGS((int s,char *buf,int len,int flags));
int send_mbuf __ARGS((int s,struct mbuf *bp,int flags,char *to,int tolen));
int sendto __ARGS((int s,char *buf,int len,int flags,char *to,int tolen));
int shutdown __ARGS((int s,int how));
char *sockerr __ARGS((int s));
int socket __ARGS((int af,int type,int protocol));
void sockinit __ARGS((void));
int sockkick __ARGS((int s));
int socklen __ARGS((int s,int rtx));
struct proc *sockowner __ARGS((int s,struct proc *newowner));
char *sockstate __ARGS((int s));
int usprintf __ARGS((int s,char *fmt,...));
#endif /* SOCK_STREAM */